package com.lykj.llw.box.adapter

import com.bumptech.glide.load.resource.bitmap.RoundedCorners
import com.bumptech.glide.load.resource.drawable.DrawableTransitionOptions
import com.bumptech.glide.request.RequestOptions
import com.chad.library.adapter.base.BaseQuickAdapter
import com.chad.library.adapter.base.viewholder.BaseViewHolder
import com.lykj.lib_base.component.GlideApp
import com.lykj.llw.box.R
import me.jessyan.autosize.utils.AutoSizeUtils

/**
 * ================================================
 * 商品详情页图片适配器
 * ================================================
 *
 * @author gosha
 * @date 2023/10/23-10:39
 */
class DetailPicAdapter:BaseQuickAdapter<String,BaseViewHolder>(R.layout.item_detail_pic){
    override fun convert(holder: BaseViewHolder, item: String) {
        item?.let {
            //图片加载自己实现
            GlideApp.with(context)
                .load(item)
                .apply(
                    RequestOptions.bitmapTransform(
                        RoundedCorners(
                            AutoSizeUtils.dp2px(
                                context,
                                7.5f
                            )
                        )
                    )
                )
                .transition(DrawableTransitionOptions.withCrossFade())
                .into(holder.getView(R.id.iv_pic))
        }
    }
}